# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=uncrustify
pkgver=0.71.0
pkgrel=0
pkgdesc="Source code beautifier"
url="https://github.com/uncrustify/uncrustify"
arch="all"
license="GPL-2.0-or-later"
makedepends="cmake python3"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/uncrustify/uncrustify/archive/uncrustify-$pkgver.tar.gz"
builddir="$srcdir/uncrustify-uncrustify-$pkgver"

build() {
	[ "$CARCH" = "s390x" ] && sed -i '/^12004/d' tests/c-sharp.test
	cmake -B build . \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr
	make -C build
}

check() {
	make -C build test
}

package() {
	make -C build DESTDIR="$pkgdir" PREFIX=/usr install

	install -Dm644 etc/*.cfg -t "$pkgdir"/usr/share/$pkgname
}

sha512sums="220ecbebb1c1d6abadb96c339e4ca9b264a04fa08bc83e9b0fabba5fae425efd1911d175d18b635521614ec9c33aa389fadaeec62ebf28a5d71e595900a92181  uncrustify-0.71.0.tar.gz"
